package cn.iocoder.yudao.module.infrastructure.notify.controller.app.vo;

import cn.iocoder.yudao.module.infrastructure.notify.controller.admin.vo.message.NotifyMessageRespVO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

@Schema(description = "用户 App - 站内信 Response VO") // FIXME 新增
@Data
public class AppNotifyMessageRespVO extends NotifyMessageRespVO {

    @Schema(description = "模板名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "test_01")
    private String templateName;

    @Override
    public String getTemplateContent() {
        String content = super.getTemplateContent();
        if (content != null) {
            // 优先返回模板内容的第一句话，其他内容从模板参数中获取
            String[] contents = content.split("[，,。.！!；;]");
            if (contents.length > 0) {
                return contents[0];
            }
        }
        return content;
    }

}
